﻿using System.Windows;
using Microsoft.Phone.Scheduler;
using System.Net;
using System;

namespace Background
{
    public class ScheduledAgent : ScheduledTaskAgent
    {
        
        protected override void OnInvoke(ScheduledTask task)
        {
            WebClient myWebClient = new WebClient();
            myWebClient.Headers["User-Agent"] = "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)";
            myWebClient.DownloadStringAsync(new Uri("http://www.shoppersstop.com/formhandlerservlet?actionName=shoppersBasicSearch&targetNodeLink=/shopBy.jsp&currentNodeLink=/index.jsp&formName=gv&categoryName=010102&searchString=category_010102+brand_proline", UriKind.Absolute));
            myWebClient.DownloadStringCompleted += myWebClient_DownloadStringCompleted;
        }

        void myWebClient_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            string fullHtml = e.Result.ToString();
        }

        public void Complete()
        {
            NotifyComplete();
        }
    }
}